package com.leoman.service;

import com.leoman.entity.Letter;
import com.leoman.exception.*;
import com.leoman.service.common.ICommonService;
import org.springframework.data.domain.Page;
import org.springframework.web.multipart.MultipartRequest;

/**
 * LetterService
 * Created by 涂奕恒 on 2016/11/23 0023 下午 3:52.
 */
public interface LetterService extends ICommonService<Letter> {

    // 信件列表
    Page<Letter> iPageForApp(Integer userId, Integer type, Integer isMe, Integer pageNum, Integer pageSize);

    // 我的打赏信件列表or我的收信列表
    Page<Letter> iPagePlusForApp(Integer userId, Integer type, Integer pageNum, Integer pageSize);

    // 信件详情
    Letter iFindOneForApp(Integer userId, Integer letterId) throws ParamErrorException, LetterNotFindException;

    // 添加信件
    Integer addLetterInfo(Boolean isAdmin,
                          Integer userId,
                          Integer tempId,
                          Integer type,
                          String title,
                          String content,
                          Integer textCount,
                          Integer stampId,
                          Integer paperId,
                          Integer mailerId,
                          Integer sendType,
                          String userName,
                          String mobile,
                          String address,
                          Integer toUserId,
                          String toUserName,
                          String toMobile,
                          String toAddress,
                          Integer isHidden,
                          String openMoney,
                          Integer imgNum,
                          Integer isDraft,
                          MultipartRequest multipartRequest) throws ParamErrorException;

    // 接收信件
    Integer getLetterInfo(Integer userId,
                          Integer letterId,
                          String userName,
                          String mobile,
                          String address,
                          Integer stampId,
                          Integer paperId,
                          Integer mailerId,
                          Integer sendType)
            throws ParamErrorException,
            UserNotFindException,
            UserSealStatusException,
            LetterNotFindException,
            LetterAcceptCountMaxException;

    // 用户使用账户余额打赏信件
    void payLetterInfo(Integer userId, Integer letterId)
            throws ParamErrorException,
            UserNotFindException,
            UserSealStatusException,
            LetterNotFindException,
            MoneyShortException,
            LetterMoneyExistException;

    // 用户使用账户余额发送信件
    void sendLetterInfo(Integer userId, Integer letterId, Double money)
            throws ParamErrorException,
            UserNotFindException,
            UserSealStatusException,
            LetterNotFindException,
            MoneyShortException;

    // 用户使用账户余额接收信件
    void getLetterInfo(Integer userId, Integer letterId, Double money)
            throws ParamErrorException,
            UserNotFindException,
            UserSealStatusException,
            LetterNotFindException,
            MoneyShortException,
            LetterMoneyExistException;

    // 获取该用户的信件草稿
    Letter iFindDraftByUserId(Integer userId) throws ParamErrorException, NoDataException;

    // 信件列表（分页）
    Page<Letter> pageByParams(String userName, String startTime, String endTime, Integer type, Integer status, Integer pageNum, Integer pageSize);

    // 置顶
    Integer toTop(Integer letterId);

    // 批量删除信件
    Integer batchDelete(String ids);

    // 标记为已打印
    Integer modifyPrintStatus(Integer letterId);

    // 修改付款状态
    void changeMoneyStatus(Integer id);
}